<?php 
define("SUCCESS_CODE",0);
define("ERROR_CODE",-1);
class Base{
	var $rs = array(
		'status' => SUCCESS_CODE,
		'message'=> '',
		'data'   => ''
	);
	//封装返回数据
	public function data( $data )
	{		
		$this->rs["status"] = SUCCESS_CODE;
		$this->rs["data"] = $data;

		return $this;
	}

	public function message( $message )
	{		
		$this->rs["message"] = $message;
		return $this;
	}

	//发送错误
	public function error( $message='' )
	{
		$this->rs["status"] = ERROR_CODE;
		$this->rs["message"] = $message;

		return $this;
	}

	public function end(){
		echo json_encode($this->rs);
	}

	

	
}
?>